<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>防抖</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.js"></script>
</head>

<body>
    <span>搜索内容：<input type="text" name="" id=""></span>
</body>
<script>
    let input = document.querySelector('input');
    input.oninput = _.debounce(function (params) {
        console.log('ajax发请求');
    }, 1000)
</script>

</html>